<!-- coderxiaoluo  𝙨𝙝𝙖𝙙𝙤𝙬 𝙤𝙛 𝙩𝙝𝙚 𝙨𝙪𝙣-->
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <!-- 
  描述
统计字符串中每个字符的出现频率，返回一个 Object，key 为统计字符，value 为出现频率
1. 不限制 key 的顺序
2. 输入的字符串参数不会为空
3. 忽略空白字符

'hello world'
{h: 1, e: 1, l: 3, o: 2, w: 1, r: 1, d: 1}
 -->
  <script>
    function count(str) {
      const m = {}
    for(let k of str){
        if(k === ' ') continue
        if(k in m){
            m[k]++
        } else {
            m[k] = 1
        }
    }
    return m

    }
    count('hello world')
  </script>

</body>

</html>